//
//  MainTabBarViewController.m
//  tangshantongjiAPPFull
//
//  Created by yuntai on 2018/5/8.
//  Copyright © 2018年 yuntai. All rights reserved.
//

#import "MainTabBarViewController.h"
#import "EPublicMacros.h"

@interface MainTabBarViewController ()

@end

@implementation MainTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(updateMessageNotiMethod:) name:kXMPPRecvChatMsgNotifaction object:nil];
}

-(void)dealloc{
    [[NSNotificationCenter defaultCenter]removeObserver:self name:kXMPPRecvChatMsgNotifaction object:nil];
}

- (void)updateMessageNotiMethod:(NSNotification *)noti{
    
    NSString *bagvalue = [[[[self tabBar]items]objectAtIndex:1]badgeValue]?:@"";
    
    [[[[self tabBar]items]objectAtIndex:1]setBadgeValue:[NSString stringWithFormat:@"%ld",[bagvalue integerValue]+1]];
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
